package com.itheima.health.exception;


import com.itheima.health.entity.Result;
import lombok.extern.slf4j.Slf4j;
import org.jfree.util.Log;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
/**
 * @version 1.0
 * @description 说明
 * @package com.itheima.exception
 */
@RestControllerAdvice // advice通知、建议 切面aop技术
@Slf4j
public class GlobalExceptionHandler {
    /**
     * 捕获业务异常
     * @param e
     * @return
     */
    @ExceptionHandler(BaseException.class)
    public Result baseException(BaseException e){
        Log.info("异常信息：{}",e);
        return Result.builder().flag(false).message(e.getMessage()).build();
    }
}
